/*
* $Id: ConsoleReader.java 83 2012-12-19 16:09:13Z Denis.Skalsky@gmail.com $
*/
package com.globallogic.skalskyy.javabasic.inputdata;

import java.util.Scanner;

/**
* ConsoleReader implements to get inputted data from console
* @author $Author: denis.skalsky@gmail.com $
* @version $Revision: 39 $
*/
public class ConsoleReader implements IncomingData {
	
	/** Console command prompt */
	public enum ConsoleCommandPrompt {
		PRIME(Messages.PRIME_NUMBER_COMMAND_PROMPT),
		NEIGHBOURING(Messages.NEIGHBOURING_NUMBERS_COMMAND_PROMPT),
		TWOWORDS(Messages.TWO_WORDS_COMMAND_PROMPT),
		DAYOFWEEK(Messages.DAY_OF_WEEK_COMMAND_PROMPT);
		
		private ConsoleCommandPrompt(String commandPrompt) {
			this.commandPrompt = commandPrompt;
		}
		
		private String commandPrompt;
		
		public String getCommandPrompt() {
			return this.commandPrompt;
		}		
	}
	
	/** Console command prompt */
	private ConsoleCommandPrompt consoleCommandPrompt;

	/** Scan the console */
	private Scanner scanner = new Scanner(System.in);
	
	public ConsoleReader(ConsoleCommandPrompt consoleCommandPrompt) {
		this.consoleCommandPrompt = consoleCommandPrompt;
	}
	
	/**
	* Get inputted data as string from console
	* @return inputted value
	*/
	public String getValue() {
	    System.out.println(consoleCommandPrompt.getCommandPrompt());
		return scanner.nextLine();
	}
}